<?php
	
	/**
	 * Verifies bootstrapper execution to ensure file
	 * necessities, and disabling direct access
	 */
	defined('ENGINE') or exit;
	
	/**
	 * Telephone number validation, check if
	 * supplied number is written in a correct syntax
	 */
	function is_valid_phone($number = NULL)
	{
		$number = (string) $number;
		
		if(!is_null($number))
		{
			if(preg_match('/^([0-9]( |-|.)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-|.)?([0-9]{3}( |-|.)?[0-9]{4}|[a-zA-Z0-9]{7})$/', $number))
			{
				return(true);
			}
		}
		
		return(false);
	}

?>